#include<iostream>
#include<cstdio>
#define sto using
#define stoorz namespace
#define orz std;
sto stoorz orz;

int n,q;
int a[8010];
int flg[8010];

struct abc{
	int x,id;
}b[8010];

void inflg()
{
	for(int i=1;i<=n;i++)
		flg[b[i].id]=i;
}

int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin>>n>>q;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]),b[i]=(abc){a[i],i};
	for(int i=1;i<=n;i++)
		for(int j=i;j>=2;j--)
			if(b[j].x<b[j-1].x)
				swap(b[j],b[j-1]);
	inflg();
	while(q--)
	{
		int typ,x,v;
		scanf("%d%d",&typ,&x);
		if(typ==1)
		{
			scanf("%d",&v);
			b[flg[x]].x=v;
			int i=flg[x]+1;
			while((b[i-1].x>b[i].x||b[i-1].id>b[i].id&&b[i-1].x==b[i].x)&&i<=n) swap(b[i-1],b[i]),i++;
			i=flg[x];
			while((b[i-1].x>b[i].x||b[i-1].id>b[i].id&&b[i-1].x==b[i].x)&&i<=n) swap(b[i-1],b[i]),i--;
			inflg();
		}
		else
			printf("%d\n",flg[x]);
	}
	return 0;
}
